package com.zondy.mapgisdrawtool;

import android.content.Context;
import android.view.View;

import com.gis_luq.lib.Draw.DrawTool;
import com.zondy.mapgis.android.graphic.Graphic;
import com.zondy.mapgis.android.mapview.MapView;

/**
 * 绘图点击事件
 * 
 * @Author admin
 * @Date 2017-7-10 下午12:00:01
 */
public class ToolsOnClickListener implements View.OnClickListener {

    private Context context = null;
    private DrawTool drawTool = null;
    private Graphic selectGraphic =null;

    public ToolsOnClickListener(Context context, DrawTool drawTool, Graphic selectGraphic, MapView mapView) {
        this.context = context;
        this.drawTool = drawTool;
        this.selectGraphic = selectGraphic;
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btnDrawPoint://绘制点
                drawTool.activate(DrawTool.POINT);
                break;
            case R.id.btnDrawPolyline://绘制线
                drawTool.activate(DrawTool.POLYLINE);
                break;
            case R.id.btnDrawFreePolyline://绘制流状线
                drawTool.activate(DrawTool.FREEHAND_POLYLINE);
                break;
            case R.id.btnDrawPolygon://绘制面
                drawTool.activate(DrawTool.POLYGON);
                break;
            case R.id.btnDrawFreePolygon://绘制流状面
                drawTool.activate(DrawTool.FREEHAND_POLYGON);
                break;
            case R.id.btnDrawCircle://绘制圆
                drawTool.activate(DrawTool.CIRCLE);
                break;
            case R.id.btnDrawEnvlope://绘制矩形
                drawTool.activate(DrawTool.ENVELOPE);
                break;
            case R.id.btnDrawSave://保存	
                drawTool.sendDrawEndEvent();
                break;
            case R.id.btnDrawUndo://回退
                if (drawTool.isActive()){
                    drawTool.actionUndo();
                }
                break;
            case R.id.btnDrawDeleteNode://删除节点
                if (drawTool.isActive()){
                    drawTool.actionDelete();
                }
                break;
        }

    }
}
